package com.hg.miaosha.controller;

import com.hg.miaosha.common.util.R;
import com.hg.miaosha.common.util.RedisUtil;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * @Author: skh
 * @Date: 2019/6/20 15:58
 * @Description:
 */
@RestController
@Slf4j
@RequestMapping("/redis")
@Api(tags = "redis相关接口")
public class RedisController {

    @Autowired
    RedisUtil redisUtil;

    @GetMapping("/set")
    public R set() {
        redisUtil.set("name","尚凯辉");
        return R.success();
    }

    @GetMapping("/get")
    public R get() {
        String name = redisUtil.get("name");
        return R.success(name);
    }
}
